<p>This rule raises an issue when a function parameter has an object literal as its default value.</p>
<h2>Why is this an issue?</h2>
<p>Using object literals as default parameters creates unexpected behavior when the function is called with partial objects.</p>
<p>When you define a parameter like <code>foo = {a: false, b: true}</code> and then call the function with <code>{a: true}</code>, JavaScript
completely replaces the default object instead of merging the properties. This means the <code>b</code> property disappears entirely, which is rarely
the intended behavior.</p>
<p>This pattern becomes especially problematic as your code evolves. When you add new properties to the default object, any existing function calls
that pass partial objects will lose those new default values. This can introduce subtle bugs that are difficult to track down.</p>
<p>Object destructuring with individual default values provides more predictable behavior. Each property gets its own default value, and JavaScript
only overrides the properties you explicitly provide.</p>
<h3>What is the potential impact?</h3>
<p>This issue can lead to runtime errors when code expects certain properties to exist but they have been inadvertently removed. It can also cause
logical errors where missing properties result in incorrect application behavior, making debugging more difficult.</p>
<h3>How to fix?</h3>
<p>Replace object literal defaults with object destructuring and individual property defaults. This ensures each property has its own default value
that won’t be lost when partial objects are passed.</p>
<h4>Non-compliant code example</h4>
<pre data-diff-id="1" data-diff-type="noncompliant">
const processOptions = (options = {a: false, b: 123}) =&gt; {
  // When called with {a: true}, b becomes undefined
  console.log(options.a, options.b);
}; // Noncompliant
</pre>
<h4>Compliant code example</h4>
<pre data-diff-id="1" data-diff-type="compliant">
const processOptions = ({a = false, b = 123} = {}) =&gt; {
  // When called with {a: true}, b retains its default value of 123
  console.log(a, b);
};
</pre>
<h3>Documentation</h3>
<ul>
  <li> <a href="https://github.com/sindresorhus/eslint-plugin-unicorn#readme">eslint-plugin-unicorn</a> - Rule <a
  href="https://github.com/sindresorhus/eslint-plugin-unicorn/blob/HEAD/docs/rules/no-object-as-default-parameter.md">no-object-as-default-parameter</a> </li>
  <li> MDN - Default parameters - <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Default_parameters">Official
  documentation on JavaScript default parameters</a> </li>
  <li> MDN - Destructuring assignment - <a
  href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment">Guide to destructuring assignment in
  JavaScript</a> </li>
</ul>
